import datetime

from google.appengine.ext import db
from google.appengine.ext import bulkload
from google.appengine.api import datastore_types
from google.appengine.ext import search

class GroupLoader(bulkload.Loader):
  def __init__(self):
#{u'short': u'ACP', u'created': 1995, u'official': u'African Carribean and Pacific', u'purpose': 2, u'members': {u'DO': [], u'BF': [], u'DM': [], u'DJ': [], u'BB': [], u'DC': [], u'BJ': [], u'JM': [], u'ZA': [], u'BW': [], u'HN': [], u'FJ': [], u'SL': [], u'BZ': [], u'RW': [], u'TZ': [], u'AG': [], u'NA': [], u'TT': [], u'NE': [], u'NG': [], u'LS': [], u'TG': [], u'TD': [], u'PG': [], u'GW': [], u'ZM': [], u'CI': [], u'VC': [], u'CM': [], u'MR': [], u'CG': [], u'CF': [], u'AO': [], u'BI': [], u'HT': [], u'GD': [], u'GY': [], u'GA': [], u'GN': [], u'GM': [], u'ZW': [], u'CU': [], u'GH': [], u'MG': [], u'KE': [], u'SR': [], u'LC': [], u'KN': [], u'MU': [], u'MW': [], u'SN': [], u'ML': [], u'SB': [], u'UG': [], u'MZ': []}, u'active': True, u'type': 0}

    bulkload.Loader.__init__(self, 'Group',
                         [('name',str),
			  ('formal_name',str),
			  ('created', lambda x: datetime.datetime.strptime(x, '%Y') ),
			  ('active', bool),
		          ('tags', lambda x: [db.Category(y) for y in x.split(":")]),
                          ])

if __name__ == '__main__':
  bulkload.main(GroupLoader())
